#include <cstdio>
#include <algorithm>
#include <vector>
#include <iostream>
#include <cstring>
using namespace std;
const int N = 10005;
int n, m, deep, root, cnt, ans;
int dfn[N], low[N], iscp[N];
vector <int> g[N];
void clean () {
	for (int i = 0; i < n + 5; i++) {
		g[i].clear();
	}
	memset(dfn, 0, sizeof(dfn));
    memset(low, 0, sizeof(low));
    memset(iscp, 0, sizeof(iscp));
    deep = 0;
    cnt = 0;
    ans = 0;
}
void Tarjan (int u) {
    int child = 0;
    deep++;
    dfn[u] = deep;
	low[u] = deep;
    for (unsigned i = 0; i < g[u].size(); i++) {
        int v = g[u][i];
        if (!dfn[v]) {
            Tarjan(v);
            low[u] = min (low[v], low[u]);
            if (low[v] >= dfn[u]) {
                child++;
                if (u != root) {
                	iscp[u]++;
				} 
            }
        } else {
            low[u] = min (low[u], dfn[v]);
        }
    }
    if (u == root) {
    	iscp[u] = child - 1;
	} 
}
int main() {
	while (1) {
		clean();
		scanf ("%d%d", &n, &m);
		if (n == 0 && m == 0) {
			break;
		}
		int a, b;
		for (int i = 1; i <= m; i++) {
			scanf ("%d%d", &a, &b);
			a++;
			b++;
			g[a].push_back(b);
			g[b].push_back(a);
		}
		for (int i = 1; i <= n; i++) {
			if (!dfn[i]) {
				root = i;
				Tarjan (i);
				cnt++;
			}
		}
		for (int i = 1; i <= n; i++) {
			ans = max (ans, iscp[i]);
		}
		printf ("%d\n", ans + cnt);
	}
	return 0;
}
